/**
 * 
 */
package org.statewalker.core;

/**
 * An error event. It is used to notify that something goes wrong - for example
 * an exception was thrown. Keys of events of this type start with the "error"
 * prefix.
 * 
 * @author kotelnikov
 */
public class ErrorEvent extends SimpleEvent {

    /**
     * The exception corresponding to this error. Note that this field could be
     * <code>null</code>.
     */
    public final Throwable error;

    /**
     * The default constructor. This constructor just sets the internal
     * exception to <code>null</code>.
     */
    public ErrorEvent() {
        this(null);
    }

    /**
     * The constructor initializing the internal {@link #error} field.
     * 
     * @param t the exception to associate with this event.
     */
    public ErrorEvent(Throwable t) {
        super("error");
        error = t;
    }

}
